package com.moonciki.artadmin.web.commons.aop;

import com.moonciki.artadmin.core.constant.GlobalConstant;
import org.aspectj.lang.annotation.Pointcut;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 岳仕奇
 * @description: TODO
 * @date 2021/12/21 14:10
 */
public class ControllerBaseAspec {

    private final String POINT_CUT = "execution( * " + GlobalConstant.Base.base_web_package + ".controller..*.*(..))";

    @Pointcut(POINT_CUT)
    public void controllerPoint(){}

    public void getRequestParameters(HttpServletRequest request){
        Enumeration<?> enume = request.getParameterNames();

        if (null != enume) {
            Map<String, String> hpMap = new HashMap<String, String>();
            while (enume.hasMoreElements()) {
                Object element = enume.nextElement();
                if (null != element) {
                    String paramName = (String) element;
                    String paramValue = request.getParameter(paramName);
                    hpMap.put(paramName, paramValue);
                }
            }
        }
    }


}
